package com.lion.uiwithzhihu.fragments;

import com.lion.model.TopStory;
import com.lion.uiwithzhihu.R;
import com.lion.uiwithzhihu.utils.ImageUtils;
import com.lion.uiwithzhihu.utils.PreferenceUtils;
import com.xinbo.utils.UILUtils;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
public class MyFragmentItem extends Fragment
{
	private TopStory topStory;
	public MyFragmentItem(TopStory topStory)
	{
		this.topStory = topStory;
	}
	@SuppressLint("InflateParams")
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState)
	{
		View layout = inflater.inflate(R.layout.myfragment_item, null);
		ImageView mImageView= (ImageView) layout.findViewById(R.id.imageView1_iv);
		boolean isPic = PreferenceUtils.getNoPic(getContext());
		if (isPic)
		{
			ImageUtils.displayImage(getContext(), topStory.getImage(), mImageView);
		}else {
			UILUtils.displayImage(topStory.getImage(), mImageView);
		}
		
		//UILUtils.displayImage(topStory.getImage(), mImageView);
		return layout;
	}
}
